<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <style type="text/css">
            .itemClass{
                width:20px;
            }
        </style>
    </h:head>
    <h:form>
        <rich:panel header="我使用的资产" styleClass="content-hight">
            <h:panelGrid columns="4">
                <h:outputLabel value="资产名称:" />
                <h:inputText size="23" value="#{psnAsset.asset.assetName}"/>
                <h:selectOneMenu  id="first" value="#{psnAsset.asset.assetName}" 
                                  rendered="false">
                    <f:selectItem itemValue="" itemLabel="-请选择-"/>
                    <f:selectItems value="#{psnAsset.seleli}"/>
                </h:selectOneMenu>
                <h:outputLabel value="规格型号：" />
                <h:inputText size="23" id="model" value="#{psnAsset.asset.model}"/>
                <h:outputLabel value="品牌：" />
                <h:inputText size="23" id="brand" value="#{psnAsset.asset.brand}"/>
                <h:outputText value="购置日期："/>
                <h:panelGroup id="purchDate">
                    <rich:calendar value="#{psnAsset.asset.purchDateB}"
                                   locale="zh_CN"
                                   popup="true"
                                   datePattern="yyyy-MM-dd"
                                   showApplyButton="false"  style="width:200px"/>
                    至
                    <rich:calendar value="#{psnAsset.asset.purchDateE}"
                                   locale="zh_CN"
                                   popup="true"
                                   datePattern="yyyy-MM-dd"
                                   showApplyButton="false"  style="width:200px"/>
                </h:panelGroup>
            </h:panelGrid>
            <a4j:commandButton value="查询" action="#{psnAsset.deptAssets}" render="dataGroup"/>
            <hr/>
            <h:panelGroup id="dataGroup">
                <rich:dataScroller for="assetList" fastStep="3" render="dataGroup"/>
                <div style="width:750px;min-height:200px;overflow: auto;">
                    <rich:dataTable style="width:1200px;margin-bottom: 5px;"
                                    id="assetList"
                                    value="#{psnAsset.psnAssets_dept}"
                                    rows="10"
                                    styleClass="stable"
                                    var="asset">
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="资产编号"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetCode}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="资产名称"/>
                            </f:facet>
                            <h:outputText value="#{asset.assetName}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="品牌"/>
                            </f:facet>
                            <h:outputText value="#{asset.brand}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="规格型号"/>
                            </f:facet>
                            <h:outputText value="#{asset.model}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="单价"/>
                            </f:facet>
                            <h:outputText value="#{asset.price}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="购置日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.purchDate}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>
                        <rich:column style="width:160px;">
                            <f:facet name="header">
                                <h:outputText  value="保管地点"/>
                            </f:facet>
                            <h:outputText value="#{asset.place}"/>
                        </rich:column>
                        <rich:column rendered="false">
                            <f:facet name="header">
                                <h:outputText  value="厂商"/>
                            </f:facet>
                            <h:outputText value="#{asset.manufacture}"/>
                        </rich:column>
                        <rich:column rendered="false">
                            <f:facet name="header">
                                <h:outputText  value="质保日期"/>
                            </f:facet>
                            <h:outputText value="#{asset.shelfLife}">
                                <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                            </h:outputText>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="保管人"/>
                            </f:facet>
                            <h:outputText value="#{asset.keeper.cpsn_name}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:outputText  value="使用人"/>
                            </f:facet>
                            <h:outputText value="#{asset.person.cpsn_name}"/>
                        </rich:column>
                        <rich:column style="text-align: center;width:55px;">
                            <f:facet name="header">
                                <h:outputText  value="使用状况"/>
                            </f:facet>
                            <h:outputText value="在用" rendered="#{asset.useStatus eq 0}"/>
                            <h:outputText value="报废" rendered="#{asset.useStatus eq 1 and asset.checkFlag}" style="color: blue"/>
                            <h:outputText value="报损" rendered="#{asset.useStatus eq 2 and asset.checkFlag}" style="color: red"/>
                            <h:outputText value="其他" rendered="#{asset.useStatus eq 3}" style="color: orange"/>
                            <h:outputText value="申请报废" rendered="#{asset.useStatus eq 1 and !asset.checkFlag}" style="color: #3baae3"/>
                            <h:outputText value="申请报损" rendered="#{asset.useStatus eq 2 and !asset.checkFlag}" style="color: indianred"/>
                        </rich:column>
                        <rich:column style="width:160px;">
                            <f:facet name="header">
                                <h:outputText  value="备注"/>
                            </f:facet>
                            <h:outputText value="#{asset.memo}"/>
                        </rich:column>
                    </rich:dataTable>
            <rich:jQuery selector=".stable tr:odd" query="addClass('odd-row')" />
            <rich:jQuery selector=".stable tr:even" query="addClass('even-row')" />
            <rich:jQuery selector=".stable tr" event="mouseover" query="jQuery(this).addClass('active-row')" />
            <rich:jQuery selector=".stable tr" event="mouseout" query="jQuery(this).removeClass('active-row')" />
            <rich:jQuery selector=".stable tr" event="click" query="jQuery(this).addClass('click-row')"/>
            <rich:jQuery selector=".stable tr" event="click" query="jQuery('.stable tr').not(this).removeClass('click-row')"/>
                </div>
            </h:panelGroup>
        </rich:panel>
    </h:form>
</ui:composition>
